<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
  
  
  <title>
    Mysqlnew |
    
    Hexo
  </title>
  <!-- Icon -->
  
    <link rel="shortcut icon" href="/favicon.ico">
    
  
<link rel="stylesheet" href="/css/style.css">

  
  
<link rel="stylesheet" href="/fancybox/jquery.fancybox.min.css">

  
  
<script src="/js/pace.min.js"></script>

<meta name="generator" content="Hexo 6.0.0"></head>

<body>
  <main class="content">
    <section class="outer">
  <article id="post-Mysqlnew" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
      
  
  <h1 class="article-title" itemprop="name">
    Mysqlnew
  </h1>
  
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2022/09/10/Mysqlnew/" class="article-date">
  <time datetime="2022-09-09T17:16:45.000Z" itemprop="datePublished">2022-09-10</time>
</a>
      
    </div>
    

    
    
<div class="tocbot"></div>

    

    <div class="article-entry" itemprop="articleBody">
      
      
      
        <h1 id="MySQL实例"><a href="#MySQL实例" class="headerlink" title="MySQL实例"></a><code>MySQL实例</code></h1><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">graph TB</span><br><span class="line">    subgraph 基本操作</span><br><span class="line">	id1(增/删)--&gt; id4(用户) &amp; id5(数据库) &amp; id6(表) &amp; id7(字段及其配置)</span><br><span class="line">	id2(改)--&gt; id8(名称) &amp; id9(字段及其配置) &amp; id10(全局配置)</span><br><span class="line">	id3(查)--&gt; id11(全局信息)</span><br><span class="line">	end</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="增-x2F-删"><a href="#增-x2F-删" class="headerlink" title="增&#x2F;删"></a>增&#x2F;删</h2><h3 id="用户-x2F-数据库"><a href="#用户-x2F-数据库" class="headerlink" title="用户&#x2F;数据库"></a>用户&#x2F;数据库</h3><h4 id="1-增加用户-x2F-数据库-CREATE"><a href="#1-增加用户-x2F-数据库-CREATE" class="headerlink" title="1. 增加用户&#x2F;数据库(CREATE)"></a>1. 增加用户&#x2F;数据库(CREATE)</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">CREATE</span> <span class="keyword">USER</span> <span class="string">&#x27;username&#x27;</span>@<span class="string">&#x27;%&#x27;</span> IDENTIFIED <span class="keyword">BY</span> <span class="string">&#x27;newgeek123&#x27;</span>;  <span class="comment">-- 创建一个用户</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">CREATE</span> DATABASE IF <span class="keyword">NOT</span> <span class="keyword">EXISTS</span> team04_demo</span><br><span class="line"><span class="keyword">DEFAULT</span> <span class="type">CHARACTER</span> <span class="keyword">SET</span> utf8mb4</span><br><span class="line"><span class="keyword">DEFAULT</span> <span class="keyword">COLLATE</span> utf8mb4_0900_ai_ci;   <span class="comment">-- 创建一个数据库</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">GRANT</span> <span class="keyword">ALL</span> PRIVILEGES <span class="keyword">ON</span> team04_demo.<span class="operator">*</span> <span class="keyword">TO</span> <span class="string">&#x27;username&#x27;</span>@<span class="string">&#x27;%&#x27;</span> <span class="keyword">WITH</span> <span class="keyword">GRANT</span> OPTION; <span class="comment">-- 给用户使用数据库的权限</span></span><br></pre></td></tr></table></figure>

<blockquote>
<p><strong>查看全局用户信息和权限</strong></p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="operator">&gt;</span><span class="keyword">SELECT</span> host,<span class="keyword">user</span>,Grant_priv,Super_priv <span class="keyword">FROM</span> mysql.user;</span><br></pre></td></tr></table></figure>

<p><strong>数据库定义字符集和<code>MySQL</code>配置的匹配</strong>：</p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="operator">&gt;</span><span class="keyword">DEFAULT</span> <span class="type">CHARACTER</span> <span class="keyword">SET</span> utf8</span><br><span class="line"><span class="operator">&gt;</span><span class="keyword">DEFAULT</span> <span class="keyword">COLLATE</span> utf8_general_ci;  <span class="comment">-- 警告字符集不匹配</span></span><br></pre></td></tr></table></figure>

<ul>
<li>查看下<code>MySQL</code>字符集</li>
</ul>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="operator">&gt;</span><span class="keyword">SHOW</span> VARIABLES <span class="keyword">WHERE</span> Variable_name <span class="keyword">LIKE</span> <span class="string">&#x27;character\_set\_%&#x27;</span> <span class="keyword">OR</span> Variable_name <span class="keyword">LIKE</span> <span class="string">&#x27;collation%&#x27;</span>;</span><br></pre></td></tr></table></figure>

<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="operator">&gt;</span><span class="keyword">DEFAULT</span> <span class="type">CHARACTER</span> <span class="keyword">SET</span> utf8mb4</span><br><span class="line"><span class="operator">&gt;</span><span class="keyword">DEFAULT</span> <span class="keyword">COLLATE</span> utf8mb4_0900_ai_ci; <span class="comment">-- 查询MySQL配置的字符集，修改当前数据库的字符集</span></span><br></pre></td></tr></table></figure>
</blockquote>
<h4 id="2-删除用户-x2F-数据库-DROP"><a href="#2-删除用户-x2F-数据库-DROP" class="headerlink" title="2. 删除用户&#x2F;数据库(DROP)"></a>2. 删除用户&#x2F;数据库(DROP)</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">drop</span> <span class="keyword">user</span> username@<span class="string">&#x27;%&#x27;</span>;  <span class="comment">-- 删除用户</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">drop</span> database team04_demo; <span class="comment">-- 删除数据库 </span></span><br><span class="line"></span><br><span class="line">flush privileges;  <span class="comment">-- 刷新MySQL的系统权限相关表</span></span><br><span class="line"><span class="comment">/*新设置用户或更改密码后需用flush privileges刷新MySQL的系统权限相关表，否则会出现拒绝访问，还有一种方法，就是重新启动mysql服务器，来使新设置生效*/</span></span><br></pre></td></tr></table></figure>

<h3 id="表"><a href="#表" class="headerlink" title="表"></a>表</h3><h4 id="3-增加表-CREATE"><a href="#3-增加表-CREATE" class="headerlink" title="3. 增加表(CREATE)"></a>3. 增加表(CREATE)</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">drop</span> <span class="keyword">table</span> if <span class="keyword">exists</span> student; <span class="comment">-- 提前删除已有的，防止更新替换时冲突</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> student</span><br><span class="line">(</span><br><span class="line">id <span class="type">bigint</span> <span class="keyword">not</span> <span class="keyword">null</span> auto_increment comment <span class="string">&#x27;ID&#x27;</span>,</span><br><span class="line">class_no <span class="type">varchar</span>(<span class="number">20</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">&#x27;班级No&#x27;</span>,</span><br><span class="line">college_name <span class="type">varchar</span>(<span class="number">40</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">&#x27;所属学院&#x27;</span>,</span><br><span class="line">major_name <span class="type">varchar</span>(<span class="number">40</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">&#x27;所属专业&#x27;</span>,</span><br><span class="line">student_id <span class="type">int</span> <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">&#x27;学号&#x27;</span>,</span><br><span class="line">name <span class="type">varchar</span>(<span class="number">20</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">&#x27;姓名&#x27;</span>,</span><br><span class="line">sex tinyint <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">&#x27;性别 男：1 ⼥：2&#x27;</span>,</span><br><span class="line">age <span class="type">int</span> <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">&#x27;年龄&#x27;</span>,</span><br><span class="line">intro <span class="type">varchar</span>(<span class="number">5000</span>) <span class="keyword">default</span> <span class="keyword">null</span> comment <span class="string">&#x27;个⼈简介&#x27;</span>,</span><br><span class="line">entrance_date <span class="type">char</span>(<span class="number">6</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">&#x27;⼊学时间&#x27;</span>,</span><br><span class="line">status tinyint <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">&#x27;状态：1:未毕业 2:已毕业 3：退学 4: 休学&#x27;</span>,</span><br><span class="line">create_by <span class="type">bigint</span> <span class="keyword">default</span> <span class="keyword">null</span> comment <span class="string">&#x27;创建者&#x27;</span>,</span><br><span class="line">create_time datetime <span class="keyword">not</span> <span class="keyword">null</span> <span class="keyword">default</span> <span class="built_in">current_timestamp</span> comment <span class="string">&#x27;创建时间&#x27;</span>,</span><br><span class="line">update_by <span class="type">bigint</span> <span class="keyword">default</span> <span class="keyword">null</span> comment <span class="string">&#x27;更新者&#x27;</span>,</span><br><span class="line">update_time datetime <span class="keyword">not</span> <span class="keyword">null</span> <span class="keyword">default</span> <span class="built_in">current_timestamp</span> <span class="keyword">on</span> <span class="keyword">update</span> <span class="built_in">current_timestamp</span> comment <span class="string">&#x27;更新时间&#x27;</span>,</span><br><span class="line"><span class="keyword">primary</span> key (id)</span><br><span class="line">) engine innodb <span class="keyword">DEFAULT</span> CHARSET<span class="operator">=</span>utf8mb4 comment <span class="operator">=</span> <span class="string">&#x27;学⽣基本信息表&#x27;</span>; <span class="comment">-- 最后配置的等号有无皆可</span></span><br></pre></td></tr></table></figure>

<h4 id="4-删除表-DROP"><a href="#4-删除表-DROP" class="headerlink" title="4. 删除表(DROP)"></a>4. 删除表(DROP)</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">drop</span> <span class="keyword">table</span> student;</span><br></pre></td></tr></table></figure>

<h3 id="字段"><a href="#字段" class="headerlink" title="字段"></a>字段</h3><h4 id="5-增加字段及其配置-INSERT"><a href="#5-增加字段及其配置-INSERT" class="headerlink" title="5. 增加字段及其配置(INSERT)"></a>5. 增加字段及其配置(INSERT)</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> student(id,class_no,college_name,major_name,student_id,name,sex,age,intro,entrance_date,status,create_by,create_time,update_by,update_time) <span class="keyword">values</span>(<span class="number">1</span>,<span class="number">1</span>,<span class="string">&#x27;1&#x27;</span>,<span class="string">&#x27;1&#x27;</span>,<span class="number">1</span>,<span class="string">&#x27;1&#x27;</span>,<span class="number">1</span>,<span class="number">1</span>,<span class="string">&#x27;1&#x27;</span>,<span class="string">&#x27;1&#x27;</span>,<span class="number">1</span>,<span class="number">1</span>,<span class="string">&#x27;1000-01-01 00:00:00&#x27;</span>,<span class="number">1</span>,<span class="string">&#x27;9999-12-31 23:59:59&#x27;</span>); <span class="comment">-- 向数据表中插入必要的非空内容 ; 注意字段和值逐一对应</span></span><br></pre></td></tr></table></figure>

<h4 id="6-删除字段及其配置"><a href="#6-删除字段及其配置" class="headerlink" title="6. 删除字段及其配置"></a>6. 删除字段及其配置</h4><ul>
<li>删除<strong>所有</strong>表中字段**(DELETE &#x2F; TRUNCATE)**</li>
</ul>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">delete</span> <span class="keyword">from</span> student;</span><br><span class="line"><span class="keyword">truncate</span> <span class="keyword">table</span> student;  <span class="comment">-- 效率更高</span></span><br></pre></td></tr></table></figure>

<ul>
<li>删除某个表中字段名**(DROP)**</li>
</ul>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> <span class="operator">&lt;</span>数据表名<span class="operator">&gt;</span> <span class="keyword">DROP</span> <span class="operator">&lt;</span>已有字段名<span class="operator">&gt;</span>；</span><br></pre></td></tr></table></figure>

<ul>
<li>删除表中的<strong>某一行</strong>：</li>
</ul>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">delete</span> <span class="keyword">from</span> <span class="operator">&lt;</span>数据表名<span class="operator">&gt;</span> <span class="keyword">where</span> 主键 <span class="operator">=</span> &quot;具体值&quot;;</span><br></pre></td></tr></table></figure>

<h3 id="索引"><a href="#索引" class="headerlink" title="索引"></a>索引</h3><h4 id="7-增加索引"><a href="#7-增加索引" class="headerlink" title="7. 增加索引"></a>7. 增加索引</h4><blockquote>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="operator">&gt;</span><span class="keyword">CREATE</span> <span class="keyword">TABLE</span> `project` (</span><br><span class="line"><span class="operator">&gt;</span>`p_id` <span class="type">varchar</span>(<span class="number">32</span>) <span class="keyword">NOT</span> <span class="keyword">NULL</span>,</span><br><span class="line"><span class="operator">&gt;</span>`p_name` <span class="type">varchar</span>(<span class="number">64</span>) <span class="keyword">DEFAULT</span> <span class="keyword">NULL</span>,</span><br><span class="line"><span class="operator">&gt;</span>`p_intr` text,</span><br><span class="line"><span class="operator">&gt;</span>`p_save` <span class="type">varchar</span>(<span class="number">512</span>) <span class="keyword">DEFAULT</span> <span class="keyword">NULL</span>,</span><br><span class="line"><span class="operator">&gt;</span>`p_ctime` datetime <span class="keyword">DEFAULT</span> <span class="keyword">NULL</span>,</span><br><span class="line"><span class="operator">&gt;</span><span class="keyword">PRIMARY</span> KEY (`p_id`)</span><br><span class="line"><span class="operator">&gt;</span>) ENGINE<span class="operator">=</span>InnoDB <span class="keyword">DEFAULT</span> CHARSET<span class="operator">=</span>utf8mb4</span><br></pre></td></tr></table></figure>
</blockquote>
<ul>
<li>对表中字段加主键索引：</li>
</ul>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> `project` <span class="keyword">ADD</span> <span class="keyword">PRIMARY</span> KEY ( `p_id` )</span><br></pre></td></tr></table></figure>

<ul>
<li>添加普通索引</li>
</ul>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> `project` <span class="keyword">ADD</span> INDEX index_name ( `p_ctime` )</span><br></pre></td></tr></table></figure>


<ul>
<li>对表中字段加组合(多列)索引：</li>
</ul>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> `project` <span class="keyword">ADD</span> INDEX select_by_id_name KEY ( `p_id`, `p_name` )</span><br></pre></td></tr></table></figure>

<ul>
<li>添加唯一索引</li>
</ul>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> `project` <span class="keyword">ADD</span> <span class="keyword">UNIQUE</span> ( `p_save` )</span><br></pre></td></tr></table></figure>

<ul>
<li>添加全文索引</li>
</ul>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> `project` <span class="keyword">ADD</span> FULLTEXT ( `p_intr` )</span><br></pre></td></tr></table></figure>


<h4 id="8-删除索引"><a href="#8-删除索引" class="headerlink" title="8. 删除索引"></a>8. 删除索引</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">DROP</span> INDEX id_n <span class="keyword">ON</span> student <span class="comment">-- or</span></span><br><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> student <span class="keyword">DROP</span> INDEX id;</span><br></pre></td></tr></table></figure>

<h2 id="改"><a href="#改" class="headerlink" title="改"></a>改</h2><h3 id="1-名称（ALTER）"><a href="#1-名称（ALTER）" class="headerlink" title="1. 名称（ALTER）"></a>1. 名称（ALTER）</h3><h4 id="修改表名"><a href="#修改表名" class="headerlink" title="修改表名"></a>修改表名</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> <span class="operator">&lt;</span>已有数据表名<span class="operator">&gt;</span> RENAME <span class="keyword">TO</span><span class="operator">/</span><span class="keyword">AS</span> <span class="operator">&lt;</span>新数据表名<span class="operator">&gt;</span>;</span><br></pre></td></tr></table></figure>

<h4 id="修改字段名"><a href="#修改字段名" class="headerlink" title="修改字段名"></a>修改字段名</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> <span class="operator">&lt;</span>数据表名<span class="operator">&gt;</span> CHANGE <span class="operator">&lt;</span>原有字段名<span class="operator">&gt;</span> <span class="operator">&lt;</span>已有字段名<span class="operator">&gt;</span> <span class="operator">&lt;</span>数据类型<span class="operator">&gt;</span>；</span><br></pre></td></tr></table></figure>

<h3 id="2-字段及其配置"><a href="#2-字段及其配置" class="headerlink" title="2. 字段及其配置"></a>2. 字段及其配置</h3><p><strong>修改字段默认值(ALTER)</strong></p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> <span class="operator">&lt;</span>已有数据表<span class="operator">&gt;</span> <span class="keyword">ALTER</span> <span class="operator">&lt;</span>字段<span class="operator">&gt;</span> <span class="keyword">SET</span> <span class="keyword">DEFAULT</span> <span class="operator">&lt;</span>默认值<span class="operator">&gt;</span>;</span><br></pre></td></tr></table></figure>

<p><strong>增加数据表字段(ALTER)</strong></p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> <span class="operator">&lt;</span>数据表名<span class="operator">&gt;</span> <span class="keyword">ADD</span> <span class="operator">&lt;</span>新字段名<span class="operator">&gt;</span> <span class="operator">&lt;</span>数据类型<span class="operator">&gt;</span> [……]；</span><br></pre></td></tr></table></figure>

<p><strong>修改数据类型(ALTER)</strong></p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> <span class="operator">&lt;</span>数据表名<span class="operator">&gt;</span> MODIFY <span class="operator">&lt;</span>已有字段名<span class="operator">&gt;</span> <span class="operator">&lt;</span>数据类型<span class="operator">&gt;</span>；</span><br><span class="line"></span><br><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> student MODIFY class_no <span class="type">VARCHAR</span>(<span class="number">100</span>);</span><br></pre></td></tr></table></figure>

<p><strong>修改字段对应数据值(UPDATE)</strong></p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">UPDATE</span> student</span><br><span class="line"><span class="keyword">SET</span> student_id<span class="operator">=</span><span class="number">8</span></span><br><span class="line"><span class="keyword">WHERE</span> college_name <span class="operator">=</span> <span class="string">&#x27;1&#x27;</span></span><br><span class="line"><span class="keyword">and</span> class_no <span class="operator">=</span> <span class="number">1</span>;</span><br></pre></td></tr></table></figure>

<p><strong>修改字段普通限制(ALTER)</strong></p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> student1(</span><br><span class="line">	student_id <span class="type">int</span> <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">&#x27;学号&#x27;</span>,</span><br><span class="line">    name <span class="type">varchar</span>(<span class="number">20</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">&#x27;姓名&#x27;</span></span><br><span class="line">)engine<span class="operator">=</span>innodb charset utf8mb4 comment <span class="string">&#x27;学生基本信息表&#x27;</span>; </span><br><span class="line"></span><br><span class="line">#<span class="number">1.</span></span><br><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> student1</span><br><span class="line"><span class="keyword">ADD</span> <span class="keyword">CONSTRAINT</span> showtime <span class="keyword">CHECK</span> (student_id <span class="operator">&gt;</span> <span class="number">0</span> <span class="keyword">AND</span> name <span class="operator">=</span> <span class="string">&#x27;Timmy&#x27;</span>); <span class="comment">-- 具体设置字段的限制</span></span><br><span class="line"></span><br><span class="line">#<span class="number">2.</span></span><br><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> student MODIFY class_no <span class="type">bigint</span> <span class="keyword">not</span> <span class="keyword">null</span>; <span class="comment">-- 调整为非空限制</span></span><br><span class="line"></span><br><span class="line">#<span class="number">3.</span></span><br><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> student MODIFY class_no <span class="type">bigint</span> <span class="keyword">null</span>;  <span class="comment">-- 调整为可空限制</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">show</span> <span class="keyword">create</span> <span class="keyword">table</span> student1;  <span class="comment">-- 查看各字段限制的详细信息</span></span><br></pre></td></tr></table></figure>

<h3 id="3-全局配置"><a href="#3-全局配置" class="headerlink" title="3. 全局配置"></a>3. 全局配置</h3><p><strong>修改数据库的全局特性(ALTER)</strong></p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">ALTER</span> DATABASE student</span><br><span class="line"><span class="keyword">DEFAULT</span> <span class="type">CHARACTER</span> <span class="keyword">SET</span> utf8mb4</span><br><span class="line"><span class="keyword">DEFAULT</span> <span class="keyword">COLLATE</span> utf8mb4_0900_ai_ci;</span><br></pre></td></tr></table></figure>

<p><strong>调整数据库安全配置——可以更新和删除数据(SET)</strong></p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">show</span> variables <span class="keyword">like</span> <span class="string">&#x27;SQL_SAFE_UPDATES&#x27;</span>; <span class="comment">-- 查看当前数据库权限</span></span><br><span class="line"><span class="keyword">SET</span> SQL_SAFE_UPDATES <span class="operator">=</span> <span class="number">0</span>; <span class="comment">-- &#x27;0&#x27;代表可以修改，&#x27;1&#x27;代表禁止修改</span></span><br></pre></td></tr></table></figure>

<p><strong>调整主键的增长位置</strong></p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> student AUTO_INCREMENT<span class="operator">=</span><span class="number">11</span>; <span class="comment">-- 从11位置开始增长（11已经存在）</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> student_score AUTO_INCREMENT<span class="operator">=</span><span class="number">0</span>; <span class="comment">-- 用于初始化</span></span><br></pre></td></tr></table></figure>

<h2 id="查"><a href="#查" class="headerlink" title="查"></a>查</h2><h3 id="用户"><a href="#用户" class="headerlink" title="用户"></a>用户</h3><h4 id="查看所有的用户"><a href="#查看所有的用户" class="headerlink" title="查看所有的用户"></a>查看所有的用户</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> <span class="keyword">user</span> <span class="keyword">FROM</span> mysql.user;</span><br></pre></td></tr></table></figure>

<h3 id="数据库"><a href="#数据库" class="headerlink" title="数据库"></a>数据库</h3><h4 id="查看所有的数据库"><a href="#查看所有的数据库" class="headerlink" title="查看所有的数据库"></a>查看所有的数据库</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">show</span> databases;</span><br></pre></td></tr></table></figure>

<h4 id="查看当前使用的数据库"><a href="#查看当前使用的数据库" class="headerlink" title="查看当前使用的数据库"></a>查看当前使用的数据库</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">Select</span> Database();</span><br></pre></td></tr></table></figure>

<h4 id="查看MySQL版本信息"><a href="#查看MySQL版本信息" class="headerlink" title="查看MySQL版本信息"></a>查看MySQL版本信息</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">select</span> version()</span><br></pre></td></tr></table></figure>

<h3 id="表-1"><a href="#表-1" class="headerlink" title="表"></a>表</h3><h4 id="查看所有的表"><a href="#查看所有的表" class="headerlink" title="查看所有的表"></a>查看所有的表</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">show</span> tables;</span><br></pre></td></tr></table></figure>

<h3 id="字段-1"><a href="#字段-1" class="headerlink" title="字段"></a>字段</h3><h4 id="查看所有的字段"><a href="#查看所有的字段" class="headerlink" title="查看所有的字段"></a>查看所有的字段</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">show</span> <span class="keyword">full</span> columns <span class="keyword">from</span> student;</span><br></pre></td></tr></table></figure>

<h4 id="查看所有字段浅层配置"><a href="#查看所有字段浅层配置" class="headerlink" title="查看所有字段浅层配置"></a>查看所有字段浅层配置</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> student;</span><br></pre></td></tr></table></figure>

<h4 id="查看每列字段的具体配置信息"><a href="#查看每列字段的具体配置信息" class="headerlink" title="查看每列字段的具体配置信息"></a>查看每列字段的具体配置信息</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">desc</span> student; <span class="comment">-- or</span></span><br><span class="line"><span class="keyword">show</span> columns <span class="keyword">from</span> student</span><br></pre></td></tr></table></figure>

<h4 id="查看指定字段"><a href="#查看指定字段" class="headerlink" title="查看指定字段"></a>查看指定字段</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> 要查询的列名称</span><br><span class="line"><span class="keyword">FROM</span> 表名</span><br><span class="line">[<span class="keyword">WHERE</span> 满足的行条件]</span><br><span class="line">[<span class="keyword">GROUP</span> <span class="keyword">BY</span> 分组的依据] <span class="comment">---- 查询结果只显示每组的一条记录</span></span><br><span class="line">[<span class="keyword">ORDER</span> <span class="keyword">BY</span> 排序的依据] <span class="comment">---- order by 对查询结果排序 -&gt; desc 按降序排列；默认asc按升序排列</span></span><br><span class="line">[LIMIT 限定输出结果];	<span class="comment">---- 限定输出行数  limit 2,2; -&gt; #从第3条数据开始查询2条</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> students <span class="keyword">order</span> <span class="keyword">by</span> age <span class="keyword">desc</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">select</span> sid,sname,age,phone <span class="keyword">from</span> students <span class="keyword">group</span> <span class="keyword">by</span> age;</span><br><span class="line"></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> students <span class="keyword">order</span> <span class="keyword">by</span> age limit <span class="number">2</span>,<span class="number">2</span>;</span><br></pre></td></tr></table></figure>

<h3 id="索引-1"><a href="#索引-1" class="headerlink" title="索引"></a>索引</h3><h4 id="查看所有的索引"><a href="#查看所有的索引" class="headerlink" title="查看所有的索引"></a>查看所有的索引</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">show</span> index <span class="keyword">from</span> student;</span><br></pre></td></tr></table></figure>

<h4 id="查看所有的主键"><a href="#查看所有的主键" class="headerlink" title="查看所有的主键"></a>查看所有的主键</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">show</span> keys <span class="keyword">from</span> student;</span><br></pre></td></tr></table></figure>

<h4 id="查看字符集和校对规则"><a href="#查看字符集和校对规则" class="headerlink" title="查看字符集和校对规则"></a>查看字符集和校对规则</h4><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">show</span> <span class="type">character</span> <span class="keyword">set</span>; <span class="comment">--字符集规则 charset </span></span><br><span class="line"><span class="keyword">show</span> <span class="keyword">collation</span>; <span class="comment">-- 校对规则 collate</span></span><br></pre></td></tr></table></figure>

<h2 id="外键"><a href="#外键" class="headerlink" title="#外键"></a>#外键</h2><h4 id="创建表成功后，再添加外键约束"><a href="#创建表成功后，再添加外键约束" class="headerlink" title="创建表成功后，再添加外键约束"></a>创建表成功后，再添加外键约束</h4><p>外键用于与另一张表的<strong>关联</strong>。是能确定另一张表记录的字段，用于保持数据的一致性。</p>
<ul>
<li>一个表中的 FOREIGN KEY 指向另一个表中的 UNIQUE KEY</li>
<li>FOREIGN KEY 约束用于预防破坏表之间连接的行为</li>
<li>FOREIGN KEY 约束能防止非法数据插入外键列，因为它必须是它指向的那个表中的值之一</li>
</ul>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">-- 年级表</span></span><br><span class="line"><span class="keyword">CREATE</span> <span class="keyword">TABLE</span> `grade` (</span><br><span class="line">  `id` <span class="type">INT</span>(<span class="number">30</span>) <span class="keyword">NOT</span> <span class="keyword">NULL</span> AUTO_INCREMENT COMMENT <span class="string">&#x27;年级id&#x27;</span>,</span><br><span class="line">  `name` <span class="type">VARCHAR</span>(<span class="number">50</span>) <span class="keyword">NOT</span> <span class="keyword">NULL</span> COMMENT <span class="string">&#x27;年级名称&#x27;</span>,</span><br><span class="line">  <span class="keyword">PRIMARY</span> KEY (`id`)</span><br><span class="line">)ENGINE<span class="operator">=</span>INNODB <span class="keyword">DEFAULT</span> CHARSET<span class="operator">=</span>utf8</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">-- 学生表</span></span><br><span class="line"><span class="keyword">CREATE</span> <span class="keyword">TABLE</span> IF <span class="keyword">NOT</span> <span class="keyword">EXISTS</span> `student` (</span><br><span class="line">  `id` <span class="type">INT</span>(<span class="number">4</span>) <span class="keyword">NOT</span> <span class="keyword">NULL</span> AUTO_INCREMENT COMMENT <span class="string">&#x27;学号&#x27;</span>,</span><br><span class="line">  `name` <span class="type">VARCHAR</span>(<span class="number">30</span>) <span class="keyword">NOT</span> <span class="keyword">NULL</span> <span class="keyword">DEFAULT</span> <span class="string">&#x27;匿名&#x27;</span> COMMENT <span class="string">&#x27;姓名&#x27;</span>,</span><br><span class="line">  `email` <span class="type">VARCHAR</span>(<span class="number">30</span>) <span class="keyword">DEFAULT</span> <span class="keyword">NULL</span> COMMENT <span class="string">&#x27;邮箱&#x27;</span>,</span><br><span class="line">  `id_grade` <span class="type">INT</span>(<span class="number">30</span>) <span class="keyword">NOT</span> <span class="keyword">NULL</span> COMMENT <span class="string">&#x27;年级id&#x27;</span>,</span><br><span class="line">  <span class="keyword">PRIMARY</span> KEY(`id`)</span><br><span class="line">) ENGINE<span class="operator">=</span>INNODB <span class="keyword">DEFAULT</span> CHARSET<span class="operator">=</span>utf8</span><br><span class="line"></span><br><span class="line"><span class="comment">-- DROP TABLE `grade`;</span></span><br><span class="line"><span class="comment">-- DROP TABLE `student`;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建表的时候没有外键关系</span></span><br><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> `student` </span><br><span class="line"><span class="keyword">ADD</span> <span class="keyword">CONSTRAINT</span> `fk_id_grade` <span class="keyword">FOREIGN</span> KEY (`id_grade`) <span class="keyword">REFERENCES</span> `grade` (`id`);</span><br><span class="line"><span class="comment">-- ALTER TABLE 表 ADD CONSTRAINT 约束名 FOREIGN KEY (作为外键的列) REFERENCES 哪个表 (哪个字段)</span></span><br><span class="line"></span><br><span class="line"><span class="comment">--撤销 FOREIGN KEY 约束</span></span><br><span class="line"><span class="keyword">ALTER</span> <span class="keyword">TABLE</span> `student`</span><br><span class="line"><span class="keyword">DROP</span> <span class="keyword">CONSTRAINT</span> `fk_id_grade`</span><br></pre></td></tr></table></figure>



<h4 id="参考资料合集"><a href="#参考资料合集" class="headerlink" title="参考资料合集"></a>参考资料合集</h4><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/chenlu5201314/article/details/100521863">1062 - Duplicate entry ‘1-1’ for key ‘PRIMARY’</a></p>
<p><a target="_blank" rel="noopener" href="https://www.cnblogs.com/mayytest1202/p/10330208.html">MySQL：SELECT 语句（六） CONCAT() 函数的使用</a></p>
<p>Index</p>
<p><a target="_blank" rel="noopener" href="https://www.cda.cn/discuss/post/details/607d22085bf7943333002abf">MySQL报错Duplicate index ‘ename’ defined on the table ‘test.emp’.</a></p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_41573234/article/details/80328281">MySQL——删除索引</a></p>
<p><a target="_blank" rel="noopener" href="https://www.cnblogs.com/jianmingyuan/p/6740090.html">MySQL索引详解及优化(key和index区别)</a></p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/JockLiu/article/details/97290667">MySQL||唯一约束（Unique Key）和非空约束（NOT NULL）</a></p>
<p>全局配置</p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_42894018/article/details/81463085">关于MySQL安装成功后在cmd命令提示符下,mysql指令无效的解决方案</a></p>
<p>[Navicat for Mysql修改MySQL数据库密码](<a target="_blank" rel="noopener" href="https://www.cnblogs.com/zui-ai-java/p/10411000.html#:~:text=Navicat">https://www.cnblogs.com/zui-ai-java/p/10411000.html#:~:text=Navicat</a> for Mysql修改MySQL数据库密码，图文详解 1.创建一个连接 2.打开连接,3.按照图示123依次点击 4.输入新密码 5.查看实现修改密码功能的SQL语句（此步骤非必须） 6.最关键的一步：点击保存 7.出现如下现象，恭喜你，修改密码成功！)</p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/weixin_45682496/article/details/115862243">Mysql设置主键自增，删除数据后，主键id依然从删除位置增加</a></p>
<p>Table</p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/THISFOREVERYONE/article/details/107000266">MySQL查看表的字段，数据类型以及是否允许非空等</a></p>
<p>[MySQL怎么删除某一字段的所有值](<a target="_blank" rel="noopener" href="https://www.php.cn/mysql-tutorials-459616.html#:~:text=mysql%E5%88%A0%E9%99%A4%E6%9F%90%E4%B8%80%E5%AD%97%E6%AE%B5%E7%9A%84%E6%89%80%E6%9C%89%E5%80%BC%E7%9A%84%E6%96%B9%E6%B3%95%EF%BC%9A%E6%89%A7%E8%A1%8C[update">https://www.php.cn/mysql-tutorials-459616.html#:~:text=mysql删除某一字段的所有值的方法：执行[update</a> table_name set field_name %3D ‘’]命令即可。,如果要删除字段则执行[ALTER TABLE table_name DROP COLUMN field]命令。)</p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_29229567/article/details/82743645">MYSQL：如何清空表中的数据</a></p>
<p><a target="_blank" rel="noopener" href="http://c.biancheng.net/view/7227.html">MySQL注释：单行注释和多行注释</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="https://zhuoshi--li.gitee.io/2022/09/10/Mysqlnew/" data-id="cl7urk99n0001houm8ymv3ev2" class="article-share-link">
        Share
      </a>
      
    </footer>

  </div>

  
  
<nav class="article-nav">
  
  <a href="/2022/09/10/multisearch/" class="article-nav-link">
    <strong class="article-nav-caption">Newer</strong>
    <div class="article-nav-title">
      
      multisearch
      
    </div>
  </a>
  
  
  <a href="/2022/04/03/JAVA/" class="article-nav-link">
    <strong class="article-nav-caption">Older</strong>
    <div class="article-nav-title">JAVA</div>
  </a>
  
</nav>

  

  
  
  
  

</article>
</section>
    <footer class="footer">
  <div class="outer">
    <ul class="list-inline">
      <li>Hexo &copy; 2022</li>
      
        <li>
          
            <a href="https://beian.miit.gov.cn/" target="_blank"></a>
            
        </li>
      
      <li>Powered by <a href="http://hexo.io/" target="_blank">Hexo</a></li>
      <li>theme  <a target="_blank" rel="noopener" href="https://github.com/zhwangart/hexo-theme-ocean">Ocean</a></li>
    </ul>
    <p><ul class="list-inline">
  
  <li><i class="fe fe-smile-alt tooltip" data-tooltip="UV"></i> <span id="busuanzi_value_site_uv"></span></li>
  
  <li><i class="fe fe-bookmark tooltip" data-tooltip="PV"></i> <span id="busuanzi_value_page_pv"></span></li>
  
</ul></p>
  </div>
</footer>
  </main>
  <aside class="sidebar">
    <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/hexo.svg" alt="Hexo"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/2022/03/06/Algorithm">Home</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/Archives">Archives</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/Gallery">Gallery</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/About">About</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link nav-item-search" title="Search">
        <i class="fe fe-search"></i>
        Search
      </a>
    </li>
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      <div class="totop" id="totop">
  <i class="fe fe-rocket"></i>
</div>
    </li>
    <li class="nav-item">
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="fe fe-feed"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
  </aside>
  
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/jquery.justifiedGallery.min.js"></script>


<script src="/js/lazyload.min.js"></script>


<script src="/js/busuanzi-2.3.pure.min.js"></script>



<script src="/fancybox/jquery.fancybox.min.js"></script>





<script src="/js/tocbot.min.js"></script>


<script>
  // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto',
  });
</script>



<script src="/js/ocean.js"></script>

</body>

</html>